package com.secondGroup.utils;

import java.time.LocalDateTime;

/**
 * date 2022/5/8  14:21
 * Author: ws
 */
public class GetTimeUtil {
    /**
     * 获取一个月前的时间
     * @param now
     * @return
     */
    public static LocalDateTime getBeforeOneMonthDay(LocalDateTime now){
        int day = now.getDayOfMonth();
        int month = now.getMonth().getValue();
        int year = now.getYear();
        if(month>1){
            month--;
        }else {month=13-1;}
        LocalDateTime of = LocalDateTime.of(year,month, day, 0, 0);
        return of;
    }
}
